package com.lsk.game.redis;

import org.springframework.stereotype.Component;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

@Component
public class Redis {
	private static final JedisPool jedisPool = new JedisPool(new JedisPoolConfig(),"localhost",6379);
	public String get(String key){
		try(Jedis jedis = jedisPool.getResource()){
			return jedis.get(key);
		}
	}
	public void set(String key,String value){
		try(Jedis jedis = jedisPool.getResource()){
			jedis.set(key,value);
		}
	}
}
